//
//  usernameViewController.m
//  代码适配
//
//  Created by 郭明皓 on 16/6/22.
//  Copyright © 2016年 郭明皓. All rights reserved.
//

#import "usernameViewController.h"

@interface usernameViewController ()

@end

@implementation usernameViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:1.00 green:1.00 blue:0.81 alpha:1.00];
    // Do any additional setup after loading the view.
    self.detailimage = [UIImageView addImgWithFrame:CGRectMake(28 * Width, 85 * Height, 268 * Width, 288 * Height) AndImage:@"detailusername"];
    [self.view addSubview:_detailimage];
    self.detailimage.userInteractionEnabled = YES;
    
    //lable
    self.detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(85 * Width, 150 * Height, 83 * Width, 15 * Height)];
    UIImageView *imageView =[[UIImageView alloc]init];
    imageView.frame =CGRectMake(85 * Width, 83 * Height, 106 * Width, 15 * Height);
    UIImage *image=[UIImage imageNamed:@"usernameLabel"];
    imageView.image =image;//imageView会根据自身大小改变添加的图片的大小所以不需要额外设置image
    self.detailLabel.backgroundColor = [UIColor clearColor];
    self.detailLabel.font = [UIFont systemFontOfSize:12];
    self.detailLabel.textColor = [UIColor yellowColor];
    [self.detailimage addSubview:imageView];//添加的顺序不能错，否则图片会覆盖label
    [self.detailimage addSubview:_detailLabel];
    
    //textfield
    self.detailTextfield = [UITextField addTextFieldWithFrame:CGRectMake(45 * Width, 130 * Height, 177 * Width,  40 * Height) AndStr:@"full name" AndFont:17 AndTextColor:[UIColor redColor] andBordwith:1];
    [self.detailimage addSubview:_detailTextfield];
    [self.detailTextfield addplaceholder:@"full name" andColor:[UIColor colorWithRed:0.86 green:0.86 blue:0.86 alpha:1.00] Textfield:self.detailTextfield];
    self.detailTextfield.backgroundColor = [UIColor whiteColor];
    self.detailTextfield.layer.cornerRadius = 10;
    self.detailTextfield.layer.masksToBounds = YES;
    
    //返回按钮
    UIButton *backButton = [UIButton addBtnImage:@"back" AndFrame:CGRectMake(0, 10 * Height, 50 * Width, 50 * Height) WithTarget:self action:@selector(back:)];
    [self.view addSubview:backButton];
    
}
- (void)back:(UIButton *)back
{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    [textField becomeFirstResponder];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    if (![_detailTextfield isExclusiveTouch]) {
        [_detailTextfield resignFirstResponder];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
